package com.wngbms.netty.bytebuf;

import io.netty.buffer.ByteBuf;
import io.netty.buffer.Unpooled;

import java.nio.charset.Charset;
import java.nio.charset.StandardCharsets;

public class ByteBufDemo {


    public static void main(String[] args) {
        ByteBuf buf = Unpooled.buffer(16, 64);

//        ByteBuf directBuf = Unpooled.directBuffer(16);

        buf.writeCharSequence("hello world", StandardCharsets.UTF_8);

        if (buf.hasArray()) {
            byte[] array = buf.array();

        }

        System.out.println("===========");
    }
}
